gboolean with_parents,
GError **error)
{
- GError *temp_error = NULL;
gboolean ret = FALSE;
+ GError *temp_error = NULL;
if (with_parents)
ret = g_file_make_directory_with_parents (dir, NULL, &temp_error);
gboolean
ot_gfile_load_contents_utf8 (GFile *file,
- char **contents_out,
- char **etag_out,
+ char **out_contents,
+ char **out_etag,
GCancellable *cancellable,
GError **error)
{
- char *ret_contents = NULL;
- char *ret_etag = NULL;
- gsize len;
gboolean ret = FALSE;
+ gsize len;
+ ot_lfree char *ret_contents = NULL;
+ ot_lfree char *ret_etag = NULL;
if (!g_file_load_contents (file, cancellable, &ret_contents, &len, &ret_etag, error))
goto out;
goto out;
}
- if (contents_out)
- {
- *contents_out = ret_contents;
- ret_contents = NULL;
- }
- if (etag_out)
- {
- *etag_out = ret_etag;
- ret_etag = NULL;
- }
ret = TRUE;
+ ot_transfer_out_value (out_contents, &ret_contents);
+ ot_transfer_out_value (out_etag, &ret_etag);
out:
- g_free (ret_contents);
- g_free (ret_etag);
return ret;
}
const char *dest_path = NULL;
const char *src_path = NULL;
GError *temp_error = NULL;
- GFileInfo *src_fileinfo = NULL;
- GFileInfo *dest_fileinfo = NULL;
- GFileEnumerator *src_enum = NULL;
- GFile *dest_subfile = NULL;
- GFile *src_subfile = NULL;
const char *name;
guint32 type;
const int move_flags = G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA;
+ ot_lobj GFileInfo *src_fileinfo = NULL;
+ ot_lobj GFileInfo *dest_fileinfo = NULL;
+ ot_lobj GFileEnumerator *src_enum = NULL;
+ ot_lobj GFile *dest_subfile = NULL;
+ ot_lobj GFile *src_subfile = NULL;
dest_path = ot_gfile_get_path_cached (destination);
src_path = ot_gfile_get_path_cached (src);
ret = TRUE;
out:
- g_clear_object (&src_fileinfo);
- g_clear_object (&dest_fileinfo);
- g_clear_object (&src_enum);
- g_clear_object (&dest_subfile);
- g_clear_object (&src_subfile);
return ret;
}
ot_util_spawn_pager (GOutputStream **out_stream,
GError **error)
{
+ gboolean ret = FALSE;
const char *pager;
char *argv[2];
int stdin_fd;
pid_t pid;
- gboolean ret = FALSE;
- GOutputStream *ret_stream = NULL;
+ ot_lfree GOutputStream *ret_stream = NULL;
if (!isatty (1))
{
ot_transfer_out_value(out_stream, &ret_stream);
ret = TRUE;
out:
- g_clear_object (&ret_stream);
return ret;
}
GError **error)
{
gboolean ret = FALSE;
- GPtrArray *ret_components = NULL;
int i;
+ ot_lptrarray GPtrArray *ret_components = NULL;
if (strlen (path) > PATH_MAX)
{
ret = TRUE;
ot_transfer_out_value(out_components, &ret_components);
out:
- if (ret_components)
- g_ptr_array_unref (ret_components);
return ret;
}